/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "PROGRAMA_GRUPO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ProgramaGrupo.findAll", query = "SELECT p FROM ProgramaGrupo p"),
    @NamedQuery(name = "ProgramaGrupo.findByProgCod", query = "SELECT p FROM ProgramaGrupo p WHERE p.progCod = :progCod"),
    @NamedQuery(name = "ProgramaGrupo.findByProgFech", query = "SELECT p FROM ProgramaGrupo p WHERE p.progFech = :progFech"),
    @NamedQuery(name = "ProgramaGrupo.findByProgDocr", query = "SELECT p FROM ProgramaGrupo p WHERE p.progDocr = :progDocr")})
public class ProgramaGrupo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PROG_COD")
    private Integer progCod;
    @Column(name = "PROG_FECH")
    @Temporal(TemporalType.DATE)
    private Date progFech;
    @Column(name = "PROG_DOCR")
    private String progDocr;
    @OneToMany(mappedBy = "progCod", fetch = FetchType.LAZY)
    private List<Provision> provisionList;
    @OneToMany(mappedBy = "progCod", fetch = FetchType.LAZY)
    private List<Inscripcion> inscripcionList;
    @JoinColumn(name = "PRO_COD", referencedColumnName = "PRO_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Programa proCod;
    @JoinColumn(name = "INST_TIPO", referencedColumnName = "INST_TIPO")
    @ManyToOne(fetch = FetchType.LAZY)
    private InscripcionTipo instTipo;
    @JoinColumn(name = "ALU_COD", referencedColumnName = "ALU_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Alumno aluCod;

    public ProgramaGrupo() {
    }

    public ProgramaGrupo(Integer progCod) {
        this.progCod = progCod;
    }

    public Integer getProgCod() {
        return progCod;
    }

    public void setProgCod(Integer progCod) {
        this.progCod = progCod;
    }

    public Date getProgFech() {
        return progFech;
    }

    public void setProgFech(Date progFech) {
        this.progFech = progFech;
    }

    public String getProgDocr() {
        return progDocr;
    }

    public void setProgDocr(String progDocr) {
        this.progDocr = progDocr;
    }

    @XmlTransient
    public List<Provision> getProvisionList() {
        return provisionList;
    }

    public void setProvisionList(List<Provision> provisionList) {
        this.provisionList = provisionList;
    }

    @XmlTransient
    public List<Inscripcion> getInscripcionList() {
        return inscripcionList;
    }

    public void setInscripcionList(List<Inscripcion> inscripcionList) {
        this.inscripcionList = inscripcionList;
    }

    public Programa getProCod() {
        return proCod;
    }

    public void setProCod(Programa proCod) {
        this.proCod = proCod;
    }

    public InscripcionTipo getInstTipo() {
        return instTipo;
    }

    public void setInstTipo(InscripcionTipo instTipo) {
        this.instTipo = instTipo;
    }

    public Alumno getAluCod() {
        return aluCod;
    }

    public void setAluCod(Alumno aluCod) {
        this.aluCod = aluCod;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (progCod != null ? progCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProgramaGrupo)) {
            return false;
        }
        ProgramaGrupo other = (ProgramaGrupo) object;
        if ((this.progCod == null && other.progCod != null) || (this.progCod != null && !this.progCod.equals(other.progCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.ProgramaGrupo[ progCod=" + progCod + " ]";
    }
    
}
